﻿using BDRUtils.CustomAttribute;
using Blm.Utils.Extensions;
using System;
using System.ComponentModel.DataAnnotations;
using VisionCloud.Core.Model.Enums;
using VisionCloud.Core.Model.Ms;

namespace VisionCloud.Domain.DtoModel.MiniApp
{
    public class CollectJobDto : TaskPointIndexDto
    {
        /// <summary>
        /// 作业编号，测量设备的JobId
        /// </summary>
        [GuidRequired] public Guid JodId { get; set; }

        /// <summary>
        /// 站点编号
        /// </summary>
        [Required, Range(1, 500)] public new int PointIndex { get; set; }

        ///// <summary>
        ///// 测量设备的点云文件路径
        ///// </summary>
        //public string FilePath { get; set; }
    }

    public class TaskPointIndexDto
    {
        /// <summary>
        /// 任务Id
        /// </summary>
        [GuidRequired] public Guid TaskId { get; set; }

        /// <summary>
        /// 站点编号
        /// </summary>
        public int? PointIndex { get; set; }
    }

    public class ResetTaskPointDto : TaskPointIndexDto
    {
        /// <summary>
        /// 站点编号
        /// </summary>
        [Required] public new int PointIndex { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMsg { get; set; }
    }

    public class CollectAndUpload : MsDotCloudCollect
    {
        public CollectAndUpload(MsDotCloudCollect ms)
        {
            ms.CopyTo(this);
        }

        /// <summary>
        /// 上传状态
        /// </summary>
        public UploadStatusEnum UploadStatus { get; set; }

        public string UploadStatusStr
        {
            get
            {
                switch (UploadStatus)
                {
                    case UploadStatusEnum.待上传:
                        return "开始上传";

                    case UploadStatusEnum.上传中:
                        return "继续上传";

                    case UploadStatusEnum.上传成功:
                        return "上传完成";

                    case UploadStatusEnum.上传失败:
                        return "重新上传";

                    default:
                        return "不可上传";
                }
            }
        }

        /// <summary>
        /// 上传错误信息
        /// </summary>
        public string UploadErrorMsg { get; set; }

        /// <summary>
        /// 作业编号，测量设备的JobId
        /// </summary>
        public new Guid? JodId { get; set; }
    }
}